<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>首页</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/swiper.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/layer.css" />
    <link rel="stylesheet" type="text/css" href="../css/mdw.css" />
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../script/swiper.min.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/layer.js"></script>
    <script type="text/javascript" src="../script/mdw.js"></script>
    <script type="text/javascript" src="../script/jumpPage.js"></script>

</head>
<body>
    <header class="header indexHeader">
        <div class="headerPageLeft">
            <i class="gpsIcon"></i>
            <span></span>
            <i class="icon"></i>
        </div>
        <div onclick="openWin('search','search.html')" class="headerPageCenter ">
            <i></i>
            <span>输入搜索关键字<span>
        </div>
        <div class="headerPageRight">中文/EN</div>
    </header>
    <section class="indexPage HTML_BOX">
      <div class="banner bg-fff">
                <div class="banner_swiper swiper-container">
                    <div class="swiper-wrapper bannerList">

                      </div>
                    <div class="swiper-pagination"></div>
                </div>
        </div>
        <ul class="indexBox1">

        </ul>
        <div class="bg-eee mdkbBox" style="border-bottom:.2rem solid #EEE ; "></div>
        <div class="mdkb mdkbBox"><i></i><span class="mdkbnr" onclick="openWin('index_news','index_news.html');"></span></div>
        <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
        <div class="ms_title miaoshaBox">
            <div class="move f_c" onclick="openWin('index_miaoSha','index_miaoSha.html');">更多<i class="icon"></i></div>
        </div>
        <!-- <ul class="indexBox2 plr">
            <li class="on">
                <div class="boxflex">
                    <span class="boxtitle1">正在秒杀</span>
                    <span class="time">12:00</span>
                </div>
                <div class="border_right"></div>
            </li>
            <li>
               <div class="boxflex">
                    <span class="boxtitle2">即将开始</span>
                    <span class="time">12:00</span>
                </div>
                <div class="border_right"></div>
            </li>
            <li>
                <div class="boxflex">
                    <span class="boxtitle2">3月16号</span>
                    <span class="time">12:00</span>
                </div>
            </li>
        </ul> -->
        <div class="displayFlex indexBox3 plr miaoshaBox">
            <div class="">正在抢购，先下单先得哟~</div>
            <div class="msdjs">距结束
                <span class="djstime hh">00</span>：
                <span class="djstime mm">00</span>：
                <span class="djstime ss">00</span>
            </div>
        </div>
        <div class="ms_swiper ware_swiper swiper-container miaoshaBox">
            <div class="swiper-wrapper">
                
            </div>
            <div class="swiper-pagination"></div>
        </div>
        <div class="indexBox4">
            <div class="mztj_bg">
                <img src="../image/mztj_bg.png" />
            </div>
            <div class="plr">
                <div class="plr mztj_list">
                    <div class="tj_swiper ware_swiper swiper-container bg-fff">
                        <div class="swiper-wrapper">

                        </div>
                        <div class="swiper-pagination"></div>
                    </div>
                    <div class="move f_c"  onclick="openWarePage('1');">更多<i class="icon"></i></div>
                </div>
            </div>
        </div>
        <div class="boxHeader f_c">
            <i class="tuijian_icon"></i>
            <span id="tuijian_title">为你推荐</span>
        </div>
        <div class="bannerBox ">
                <div class="tj_bannerList swiper-container">
                    <div class="swiper-wrapper ">
                       <!-- <img src="../image/banner2.png" /> -->
                      </div>
                    <!-- <div class="swiper-pagination"></div> -->
                </div>
        </div>
        <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
        <div class="boxHeader f_c">
            <i class="new_icon"></i>
            <span id="new_title">新到商品</span>
            <div class="move f_c" onclick="openWarePage('2');">更多<i class="icon"></i></div>
        </div>
        <div class="indexBox5 displayFlex">
            <div class="boxleft">
                <div class="ware_img"><img src="../image/ware_img.png" /></div>
            </div>
            <div class="boxright">

            </div>
        </div>
        <ul id="new_lsit" class="plr wareList">

        </ul>
        <div class="boxHeader f_c">
            <i class="hot_icon"></i>
            <span id="hot_title">热销商品</span>
            <div class="move f_c" onclick="openWarePage('3');">更多<i class="icon"></i></div>
        </div>
        <div id="hot_ad" class="bannerBox">
            <img src="../image/banner3.png" />
        </div>
        <div class="hot_swiper ware_swiper swiper-container">
            <div class="swiper-wrapper">

            </div>
            <div class="swiper-pagination"></div>
        </div>
        <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
        <div class="boxHeader f_c">
            <i class="like_icon"></i>
            <span id="guess_like_title">猜你喜欢</span>
            <div class="move f_c" onclick="openWarePage('4');">更多<i class="icon"></i></div>
        </div>
        <ul id="guess_like" class="plr wareList">

        </ul>
        <div id="ad_two" class="bannerBox">
            <img src="../image/banner4.png" />
        </div>
        <div class="index_otherTitle">
                <span>别划了，划不动了</span>
        </div>
    </section>

    <!-- 底部导航 -->
    <section class="sectionH"></section>
    <section class="navigation">
    <ul>
        <li class="on" >
            <span  class="icon"></span>
            <p id="nav1">首页</p>
        </li>
        <li onclick="openWin('classify','classify.html')">
            <span class="icon"></span>
            <p id="nav2">分类</p>
        </li>
        <li onclick="openWin('groupBuy','groupBuy.html')">
            <span class="icon"></span>
            <p id="nav3">拼团</p>
        </li>
        <li  onclick="shoppingCart()">
            <span class="icon"></span>
            <p id="nav4">购物车</p>
        </li>
        <li  onclick="member()">
            <span class="icon"></span>
            <p id="nav5">我的</p>
        </li>
    </ul>
</section>
<!-- 弹窗 -->
    <div class="mask_pop">
        <div class="mask"></div>
        <div class="index_pop_banner">
            <div class="pop_close"></div>
            <img class="picture" src="" />
        </div>
    </div>
    <section class="back_top"></section>
    <div class="xiala_popmask"></div>
    <div style="left: 0.14rem;" class="xiala_pop">
         <div class="xiala_Box">
             <div class="xiala_sj" style="left: 0.52rem;"></div>
             <ul>
                 <li style="justify-content: center;" onclick="changlang(14)">大温地区</li>
                 <li style="justify-content: center;" onclick="changlang(54)">其他地区</li>
             </ul>
         </div>   
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
    //转换中英文
    $(".headerPageRight").click(function(){
        if(cnen==1){
            $api.setStorage('cnen',2);
        }else{
            $api.setStorage('cnen',1);
        }
        location.reload();
    })
    var ifready = true;
    var bannerSwiper;
    var miaosha;
    var tj_swiper;
    var hot_swiper;
    apiready = function(){
        //头部问题
        $api.fixStatusBar($api.dom('header'));
        $api.fixStatusBar($api.dom('.xiala_pop'));
        api.addEventListener({
            name: 'reload'
        }, function(ret, err) {
           location.reload();
        });
        api.addEventListener({
            name: 'index'
        }, function(ret, err) {
            var data =ret.value;
            var p={id:data.id,title:data.name};
            $api.setStorage('lang_type',p);
            $(".headerPageLeft span").html(p.title);
            location.reload();
        });
        var resultList = api.hasPermission({
        list:['location']
        });
        // console.log(JSON.stringify(resultList));
        var baiduLocation = api.require('baiduLocation');
        baiduLocation.startLocation({
            accuracy: '3km',
            filter: 1,
            autoStop: true
        }, function(ret, err) {
            if (ret.status) {
                // console.log(JSON.stringify(ret));
            } else {
                console.log(JSON.stringify(err));
            }
        });
        ifCnAndEn();
        if($api.getStorage('lang_type')==null || $api.getStorage('lang_type')=="undefined"){
            $api.setStorage('lang_type',lang_type);
            lang = lang_type;
        }
        ExitApp();
        api.setStatusBarStyle({
            color: '#fff',//设置APP状态栏背景色
            style: 'dark'
        });
        var lang = $api.getStorage('lang_type');
        if($api.getStorage('lang_type')==null || $api.getStorage('lang_type')=="undefined"){
            var lang_type = {id:14,title:'大温地区',egtitle:'Greater Vancouver'}
            $api.setStorage('lang_type',lang_type);
            lang = lang_type;
        }
        if(cnen==2){
            lang.title = lang.egtitle;
        }
        $(".headerPageLeft span").html(lang.title);

        ready();
    };
    $(".back_top").click(function(){
        $(window).scrollTop(0,300);
    })
    var ifxiala =true;
    $(".headerPageLeft").click(function(){
        if(ifxiala){
            ifxiala=false;
           $(".xiala_pop").fadeIn(300); 
           $(".xiala_popmask").addClass("on");
       }else{
            ifxiala=true;
            $(".xiala_pop").fadeOut(300);
            $(".xiala_popmask").removeClass("on");
       }
    });
    $(".xiala_popmask").click(function(){
        ifxiala=true;
        $(".xiala_pop").fadeOut(300);
        $(".xiala_popmask").removeClass("on");
    });
    $(window).scroll(function(e) {
        var startY = $(window).scrollTop();
        console.log(startY);
        ifxiala=true;
        $(".xiala_pop").fadeOut(300);
        $(".xiala_popmask").removeClass("on");
    });
    function changlang(id){
        var title;
        var egtitle;
        if(id==14){
            title="大温地区";
            egtitle="Greater Vancouver, BC";
        }else{
            title="其他地区";
            egtitle="Other";
        }
        var lang_type = {id:id,title:title,egtitle:egtitle}
        $api.setStorage('lang_type',lang_type);
        location.reload();
        console.log(lang);
    }

    //加载
    function ready(){
        pop.loading();
        getAjax(Interface.index,{},function(res){
            toDoRequest();
            var data = res.data;
            var banner = data.banner;//banner图
            var typefirst = data.typefirst;//分类
            var spike = data.spike;//秒杀
            var scoll_news = data.scoll_news;//买到新闻
            var week_price = data.week_price;//每周特价
            var week_banner = data.week_banner;//每周特价背景图片
            var tj_banner = data.tj_banner;//推荐广告
            var new_ad = data.new_ad;//新到商品广告
            var new_come = data.new_come;//新到商品列表
            var hot_ad = data.hot_ad;//热销商品广告
            var hot_sale = data.hot_sale;//热销商品列表
            var guess_like = data.guess_like;//猜你喜欢;
            var ad_two = data.ad_two;//底部banner
            var appcate = data.appcate;
            //var lang_type = data.lang_type//默认城市;
           
            //加载banner
            
            if(banner!=null || banner.length > 0){
                if(ifready){
                   $(".bannerList").empty(); 
                   // $(".tj_swiper .swiper-wrapper").empty();
                   // $(".hot_swiper .swiper-wrapper").empty();
                }else{
                    bannerSwiper.removeAllSlides();  
                    // miaosha.removeAllSlides();
                    // tj_swiper.removeAllSlides();
                    // hot_swiper.removeAllSlides();
                }
                $.each(banner,function(i,item){
                    var url = '';
                    if(cnen==1){
                        url = item.url;
                    }else{
                        url = item.egurl;
                    }
                    if(ifready){
                    $(".bannerList").append('<div onclick="openApp(\''+url+'\','+item.app_id+','+item.app_type+')" class="swiper-slide"><img src="'+getImg(item.mobile_icon)+'" /></div>');
                    }else{
                            bannerSwiper.appendSlide('<div onclick="openApp(\''+url+'\','+item.app_id+','+item.app_type+')" class="swiper-slide"><img src="'+getImg(item.mobile_icon)+'" /></div>');
                            bannerSwiper.slideTo(0, 0, false);
                    }
                })
                
                if(ifready){
                    bannerSwiper = new Swiper('.banner_swiper', {
                        autoplay: 3000,//可选选项，自动滑动
                        loop : true,
                        //speed:1000,
                        observer:true,//修改swiper自己或子元素时，自动初始化swiper 
                        observeParents:false,//修改swiper的父元素时，自动初始化swiper 
                        pagination : '.swiper-pagination',
                        autoplayDisableOnInteraction: false,
                        touchMoveStopPropagation: false,
                        onTouchStart: function(swiper) {
                            api.setFrameAttr({
                                name: api.frameName,
                                bounces: false
                            });
                        },
                        onTouchEnd: function(swiper) {
                            api.setFrameAttr({
                                name: api.frameName,
                                bounces: true
                            });
                        }

                    })
                }else{

                }
                
                
            }
            //加载分类
            $(".indexBox1").empty();
            if(appcate!=null|| appcate.length > 0){
                $.each(appcate,function(i,item){
                    
                    var name = '';
                    if(cnen==1){
                        name = item.title;
                    }else{
                        name = item.egname;
                    }
                    var html = '<li onclick="goappcate('+item.cid+','+item.type+')"><img src="'+getImg(item.icon)+'" class="icon" /><span>'+name+'</span></li>';

                    $(".indexBox1").append(html);
                })
            }
            //goClass();
            //秒杀
            if(spike!=null && spike != ""){
                console.log(spike);
                pop_timeDown(spike.end_time);
                var html = '';
                if(ifready){
                }else{
                    miaosha.removeAllSlides();
                }
                $.each(spike.product_list,function(i,item){
                    if(i==0){//每三个是一个swiper
                        html +='<div class="swiper-slide">';
                    }
                    var name = '';
                    if(cnen==1){
                        name = item.title;
                    }else{
                        name = item.egname;
                    }
                    html+='<div onclick="goWare(\''+item.id+'\')" class="wareItem">'+
                        '<div class="wareImgBox"><img src="'+getImg(item.icon)+'" /></div>'+
                        '<div class="wareName"><span>'+name+'</span></div>'+
                        '<div class="warePrice">';
                        if(item.old_price == ""){
                            html+='<span>$'+item.spike_price+'</span>';
                        }else{
                            html+='<span>$'+item.spike_price+'</span>';
                            html+='<del>$'+item.old_price+'</del>';
                        }
                        html+='</div></div>';
                   if((i+1)%3 == 0 ||(i+1)==spike.product_list.length){//判断一个swiper里面有几个数据
                        if((i+1)==spike.product_list.length){
                            html +='</div>';
                        }else{
                            html +='</div><div class="swiper-slide">';
                        }
                    }
                })
                if(ifready){
                    $(".ms_swiper .swiper-wrapper").append(html);
                    miaosha = new Swiper('.ms_swiper', {
                        slidesPerView: 'auto',
                        pagination : '.swiper-pagination',
                        observer:true,//修改swiper自己或子元素时，自动初始化swiper 
                        observeParents:false,//修改swiper的父元素时，自动初始化swiper 
                    });
                }else{
                    miaosha.appendSlide(html);
                    miaosha.slideTo(0, 0, false);
                }
                
            }else{
                $(".miaoshaBox").hide();
            }
            //买到新闻
            mdnews(scoll_news);
            //每周特价
            
            if(week_price!=null && week_price.length > 0){
                if(ifready){
                   $(".tj_swiper .swiper-wrapper").empty();
                }else{
                    tj_swiper.removeAllSlides();
                }
                var html = '';
                $.each(week_price,function(i,item){
                    if(i==0){//每三个是一个swiper
                        html +='<div class="swiper-slide">';
                    }
                    var name = '';
                    if(cnen==1){
                        name = item.title;
                    }else{
                        name = item.egname;
                    }
                    html+='<div onclick="goWare(\''+item.id+'\')" class="wareItem">'+
                        '<div class="tj_number">'+(i+1)+'</div>'+
                        '<div class="wareImgBox"><img src="'+getImg(item.icon)+'" /></div>'+
                        '<div class="wareName"><span>'+name+'</span></div>'+
                        '<div class="warePrice">';
                        if(item.old_price == ""){
                            html+='<span>$'+item.new_price+'</span>';
                        }else{
                            html+='<span>$'+item.new_price+'</span>';
                            html+='<del>'+item.old_price+'</del>';
                        }
                        html+='</div></div>';
                   if((i+1)%3 == 0 ||(i+1)==week_price.length){//判断一个swiper里面有几个数据
                        if((i+1)==week_price.length){
                            html +='</div>';
                        }else{
                            html +='</div><div class="swiper-slide">';
                        }
                    }
                })
                if(ifready){
                    $(".tj_swiper .swiper-wrapper").append(html);
                    tj_swiper = new Swiper('.tj_swiper', {
                        pagination : '.swiper-pagination',
                        observer:true,//修改swiper自己或子元素时，自动初始化swiper 
                        observeParents:false,//修改swiper的父元素时，自动初始化swiper 
                    });
                }else{
                    tj_swiper.appendSlide(html);
                    tj_swiper.slideTo(0, 0, false);
                }
                
                
            }
            $(".tj_bannerList .swiper-wrapper").empty();
            //广告 
            if(cnen==2){
                week_banner.mobile_icon = week_banner.mobile_icon2;
            }
            $(".mztj_bg img").attr("src",getImg(week_banner.mobile_icon));
            //为你推荐
            if(tj_banner!=null && tj_banner.length > 0){
                $.each(tj_banner,function(i,item){
                    var url = '';
                    if(cnen==1){
                        url = item.url;
                    }else{
                        url = item.egurl;
                    }
                    $(".tj_bannerList .swiper-wrapper").append('<div onclick="openApp(\''+url+'\','+item.app_id+','+item.app_type+')" class="swiper-slide"><img src="'+getImg(item.mobile_icon)+'" /></div>');
                })
                tj_bannerList = new Swiper('.tj_bannerList', {
                    loop : true,
                    // pagination : '.swiper-pagination',
                })
            }
            //新到商品

            if(new_ad!=null && new_ad !=""){
                var url = '';
                if(cnen==1){
                    url = new_ad.url;
                }else{
                    url = new_ad.egurl;
                }
               $(".ware_img img").attr("src",getImg(new_ad.mobile_icon));
               //var z=test.indexOf(”Script”);
               $(".boxleft").attr("onclick",'openApp(\''+url+'\','+new_ad.app_id+','+new_ad.app_type+')');
            }
            $("#new_lsit").empty();
            $(".boxright").empty();
            //新到商品列表
            if(new_come!=null && new_come.length > 0){
               $.each(new_come,function(i,item){
                    if(i>4){
                        return;
                    }
                    var name = '';
                    if(cnen==1){
                        name = item.title;
                    }else{
                        name = item.egname;
                    }
                    if(i<2){
                        var html =  '<div onclick="goWare(\''+item.id+'\')" class="wareItem2"><div class="wareName">'+
                       '<div class="wtitle"><span>'+name+'</span></div>'+
                       '<div class="warePrice">';
                       if(item.old_price == ""){
                           html+= '<span>$'+item.new_price+'</span>';
                       }else{
                           html+= '<span>$'+item.new_price+'</span><del>'+item.old_price+'</del>';
                       }
                       html+='</div></div>'+
                   '<div class="wareItem_img"><img src="'+getImg(item.icon)+'" /></div></div>';
                    $(".boxright").append(html);
                    }else{
                        var html ='<li onclick="goWare(\''+item.id+'\')" class="wareItem">'+
                            '<div class="wareImgBox"><img src="'+getImg(item.icon)+'" /></div>'+
                            '<div class="wareName"><span>'+name+'</span></div>'+
                            '<div class="warePrice">';
                            if(item.old_price == ""){
                                   html+= '<span>$'+item.new_price+'</span>';
                               }else{
                                   html+= '<span>$'+item.new_price+'</span><del>'+item.old_price+'</del>';
                               }
                            html+= '</div></li>';
                        $("#new_lsit").append(html);

                    }


                })
            }
            //热销商品广告
            if(hot_ad!=null &&  hot_ad !=""){
                var url = '';
                if(cnen==1){
                    url = hot_ad.url;
                }else{
                    url = hot_ad.egurl;
                }
               $("#hot_ad img").attr("src",getImg(hot_ad.mobile_icon));
               $("#hot_ad img").attr("onclick",'openApp(\''+url+'\','+hot_ad.app_id+','+hot_ad.app_type+')');
            }
            
            //热销商品列表
            if(hot_sale!=null &&  hot_sale.length > 0){
                if(ifready){
                   $(".hot_swiper .swiper-wrapper").empty();
                }else{
                    hot_swiper.removeAllSlides();
                }
                var html ="";
                $.each(hot_sale,function(i,item){
                    if(i==0){//每三个是一个swiper
                        html +='<div class="swiper-slide">';
                    }
                    var name = '';
                    if(cnen==1){
                        name = item.title;
                    }else{
                        name = item.egname;
                    }
                    html+='<div onclick="goWare(\''+item.id+'\')" class="wareItem">'+
                        '<div class="wareImgBox"><img src="'+getImg(item.icon)+'" /></div>'+
                        '<div class="wareName"><span>'+name+'</span></div>'+
                        '<div class="warePrice">';
                        if(item.old_price == ""){
                            html+='<span>$'+item.new_price+'</span>';
                        }else{
                            html+='<span>$'+item.new_price+'</span>';
                            html+='<del>'+item.old_price+'</del>';
                        }
                        html+='</div></div>';
                   if((i+1)%3 == 0 ||(i+1)==hot_sale.length){//判断一个swiper里面有几个数据
                        if((i+1)==hot_sale.length){
                            html +='</div>';
                        }else{
                            html +='</div><div class="swiper-slide">';
                        }
                    }
                })
                if(ifready){
                    $(".hot_swiper .swiper-wrapper").append(html);
                    hot_swiper = new Swiper('.hot_swiper', {
                        slidesPerView: 'auto',
                        pagination : '.swiper-pagination',
                        observer:true,//修改swiper自己或子元素时，自动初始化swiper 
                        observeParents:false,//修改swiper的父元素时，自动初始化swiper 
                    });
                }else{
                    hot_swiper.appendSlide(html);
                    hot_swiper.slideTo(0, 0, false);
                }
            }
            $("#guess_like").empty();
            if(guess_like!=null && guess_like.length > 0){
                $.each(guess_like,function(i,item){
                  $("#guess_like").append(getWare(item));
                })
            }
            if(ad_two!=null && ad_two != ""){
                var url = '';
                if(cnen==1){
                    url = ad_two.url;
                }else{
                    url = ad_two.egurl;
                }
                if(url){
                    $("#ad_two img").attr("onclick",'openApp(\''+url+'\','+ad_two.app_id+','+ad_two.app_type+')');
                }
                $("#ad_two img").attr("src",getImg(ad_two.mobile_icon));
            }
            pop.close();
            indexPopBanner();
            ifready =false;
        })
    }

    function goappcate(id,type){
        if(type == 1){
            openClass(id);
        }else if(type==2){
            openWin('community','community.html');
        }else if(type==3){
            openWarePage(1);
        }else if(type==4){
            openWarePage(4);
        }else if(type==5){
            openWin('classify','classify.html');
        }
    }
    
    //弹出广告
    function indexPopBanner(){
        
        var isOneTree = api.getGlobalData({
            key: 'isOneTree'
        });
        if(!isOneTree){
            api.setGlobalData({
                key: 'isOneTree',value: '1'
            });
             $api.setStorage('change_num',null);
        }
        // console.log(isOneTree);
        getAjax(Interface.advertising,{},function(res){
            var url = res.data.url;
            if(cnen==2){
                url = res.data.egurl
            }
            var change_num = $api.getStorage('change_num');
            if($api.getStorage('change_num')==null || $api.getStorage('change_num')=="undefined"){
                $api.setStorage('change_num',res.data.change_num);
                change_num = res.data.change_num;
                // console.log(change_num);
                $(".picture").attr("onclick",'openApp(\''+url+'\','+res.data.app_id+','+res.data.app_type+')');
                $(".picture").attr("src",getImg(res.data.picture)).load(function(){
                    maskOpen();
                    $(".picture").addClass("bottom_top");
                })
            }else{
                console.log(change_num);
                if(change_num == res.data.change_num){
                    return;
                }
                $api.setStorage('change_num',res.data.change_num);
                $(".picture").attr("onclick",'openApp(\''+url+'\','+res.data.app_id+','+res.data.app_type+')');
                $(".picture").attr("src",getImg(res.data.picture)).load(function(){
                    maskOpen();
                    $(".picture").addClass("bottom_top");
                })
            }
        },function(res,err){})
        
    }
    $(".pop_close").click(function(){
        maskClose();
    })

    //买到新闻
    function mdnews(scoll_news){
        if(scoll_news!=null &&  scoll_news.length > 0){
            var maxcount = scoll_news.length;
            var index = 0;
            //五秒更换一次
            $(".mdkbnr").html(scoll_news[index].title);
            setInterval(function(){
                index++;
                //如果index 和maxcount相等。说明上一个是最后一个新闻
                if(index == maxcount){
                    index =0;
                }
                $(".mdkbnr").html("");
                setTimeout(function(){
                    $(".mdkbnr").html(scoll_news[index].title);
                },200);
                
            },4800);

        }else{
            $(".mdkbBox").hide();
        }
    }
    //分类后续
    function goClass(){
        if(cnen==1){
          var html ='<li onclick="openWin(\'community\',\'community.html\')"><img src="../image/index_type_nav7.png" class="icon" /><span>买到社区</span></li>';
          html+='<li onclick="openWarePage(1);"><img src="../image/index_type_nav8.png" class="icon" /><span>每周特价</span></li>';
          html+='<li onclick="openWarePage(4);"><img src="../image/index_type_nav9.png" class="icon" /><span>猜你喜欢</span></li>';
          html+='<li onclick="openWin(\'classify\',\'classify.html\')"><img src="../image/index_type_nav10.png" class="icon" /><span>更多分类</span></li>';
          $(".indexBox1").append(html);
        }else{
          var html ='<li onclick="openWin(\'community\',\'community.html\')"><img src="../image/index_type_nav7.png" class="icon" /><span>Community</span></li>';
          html+='<li onclick="openWarePage(1);"><img src="../image/index_type_nav8.png" class="icon" /><span>Weekly Specials</span></li>';
          html+='<li onclick="openWarePage(4);"><img src="../image/index_type_nav9.png" class="icon" /><span>You May Also Like</span></li>';
          html+='<li onclick="openWin(\'classify\',\'classify.html\')"><img src="../image/index_type_nav10.png" class="icon" /><span>Move Class</span></li>';
          $(".indexBox1").append(html);
        }
    }
var timer;
function pop_timeDown(timestamp){
        timer = setInterval(function(){
            //var nowTime = Date.parse( new Date() ).toString();
            var endTime = timestamp+"000";
            var nowTime = new Date();
 
            var t = endTime - nowTime.getTime()
            //var t = endTime - nowTime.substr(0,10);
            if(t <= 0){
                clearInterval(timer);
                $(".djstime.hh").html("00");
                $(".djstime.mm").html("00");
                $(".djstime.ss").html("00");
                return false;
            }
            var d=Math.floor(t/1000/60/60/24);
            var hour=Math.floor(t/1000/60/60%24);
            var min=Math.floor(t/1000/60%60);
            var sec=Math.floor(t/1000%60);
            if(d > 0){
             hour = Number(hour) + d*24;
            }
            if (hour < 10) {
                 hour = "0" + hour;
            }
            if (min < 10) {
                 min = "0" + min;
            }
            if (sec < 10) {
                 sec = "0" + sec;
            }
            $(".djstime.hh").html(hour);
            $(".djstime.mm").html(min);
            $(".djstime.ss").html(sec);
        },1000);
        pop.close();
        // maskClose();
        // $(".pop_Item").addClass("dn");
        // maskOpen();
        // $(".joinGroup_pop").removeClass("dn");
}


</script>
<script type="text/javascript">
    function ifCnAndEn(){
        if(cnen==2){
            $(".headerPageCenter span").html('Search');
            $(".move").html("More"+'<i class="icon"></i>');
            $("#tuijian_title").html("Featured For You");
            $("#new_title").html("New Arrivals");
            $("#hot_title").html("Best Sellers");
            $("#guess_like_title").html("You May Also Like");
            $(".mdkb").addClass("en");
            $(".ms_title").addClass("en");
            $(".mztj_bg img").attr("src","../image/mztj_bgen.jpg");
            $(".mdkb").addClass("en");
            $("#nav1").html('Home');
            $("#nav2").html('Departments');
            $("#nav3").html('Deals');
            $("#nav4").html('Cart');
            $("#nav5").html('Account');
            $(".leftBox_1").html('Snack Big sale');
            $(".leftBox_2").html('Full 99 minus 50');
            $(".leftBox_3").html('Rush to buy');
            $(".index_otherTitle span").html('You\'ve reached the end');
            $(".indexBox3 div").eq(0).html('Limited Time Offers');
            $(".msdjs").html('End<span class="djstime hh">00</span>：<span class="djstime mm">00</span>：<span class="djstime ss">00</span>');
            $(".xiala_Box ul li").eq(0).html("Greater Vancouver");
            $(".xiala_Box ul li").eq(1).html("Other");
            $(".xiala_pop").css("width","3rem");
        }
    }
</script>
</html>
